#ifndef MAEMO5PROCESSRUNNER_H
#define MAEMO5PROCESSRUNNER_H

#include <QObject>
#include <QProcess>
#include <QStringList>

#include "defines.h"
#include "generatoroutputview.h"
#include "generatordata.h"

#include "maemo5qtprojectgenerator.h"


// TODO factor out commonality with symbianprocessrunner to a base class
class Maemo5ProcessRunner : public QObject
{
    Q_OBJECT

private:
    //
    // member variables
    //
    QProcess                   * m_process;
    Maemo5QtProjectGenerator   & m_generator;
    GeneratorPhase               m_generatorAction;
    bool                         m_errorWordInLogMsg;

public:
    //
    // lifetime management
    //
    Maemo5ProcessRunner(Maemo5QtProjectGenerator &generator);
    ~Maemo5ProcessRunner();

    //
    // public operators
    //
    virtual void runApp(GeneratorPhase &generatorAction, const QStringList &params);
    virtual bool errorWordInLogMessage();


    //
    // private implementation details
    //
private slots:
    void readProcessStdout();

private:
    void startProcess(const QString &command, const QStringList &arguments);
    void runDpkgBuildPackage();
    void runUnzip(const QStringList &params);
};

#endif // MAEMO5PROCESSRUNNER_H
